﻿
namespace System.Web.Mvc
{
    public class ScopeHtmlHelper : HtmlHelper, IDisposable
    {
        internal static readonly string ScopeHtmlViewDataDictionaryKey = ViewDataDictionaryExtensions.AdditionalViewDataKeyPrefix + "_ScopeHtmlHelper";
        public ScopeHtmlHelper(HtmlHelper html, ViewDataDictionary viewData)
            : base(new ViewContext(html.ViewContext, html.ViewContext.View, viewData, html.ViewContext.TempData, html.ViewContext.Writer),
               new ScopeViewDataContainer(viewData))
        {
            base.Html5DateRenderingMode = html.Html5DateRenderingMode;
            this.Parent = html;
            //不能嵌套ScopeHtmlHelerp
            ViewData[ScopeHtmlViewDataDictionaryKey] = this;
        }
        internal HtmlHelper Parent { get; private set; }
        private class ScopeViewDataContainer : IViewDataContainer
        {
            public ScopeViewDataContainer(ViewDataDictionary viewData)
            {
                ViewData = viewData;
            }

            public ViewDataDictionary ViewData { get; set; }
        }

        public void Dispose()
        {
            //TODEO
        }
    }


}
